home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Panorama / Panorama - Disk 24A (1987-12-09)(Pacific North-West Amigas Club)[b corrupt files][WB].zip / Panorama - Disk 24A (1987-12-09)(Pacific North-West Amigas Club)[b corrupt files][WB].adf / DrunkenMouse / inputhandler.c < prev    next >
C/C++ Source or Header  |  1987-10-25  |  1KB  |  69 lines

  1. /* inputhandler.c */
  2. #include <exec/types.h>
  3. #include <exec/ports.h>
  4. #include <exec/memory.h>
  5. #include <exec/tasks.h>
  6. #include <devices/input.h>
  7. #include <devices/inputevent.h>
  8. #include <intuition/intuitionbase.h>
  9.  
  10. /* ====  EXPORT  ==== */
  11. extern struct InputEvent *InputHandler();
  12. extern struct IntuitionBase *IntuitionBase;
  13. /*****/
  14.  
  15. /* ==== IMPORT ===== */
  16. extern APTR MyTask;
  17. extern ULONG INPUTEVENT;
  18. extern SHORT PosX,PosY;
  19. /***/
  20.  
  21.  
  22. struct InputEvent 
  23. *InputHandler(ev, data)
  24.    struct InputEvent *ev;
  25.    struct MemEntry *data[];
  26.  
  27. {
  28.    struct InputEvent *curr;
  29.  
  30.    curr = ev;
  31.    while(curr)
  32.    {
  33.  
  34.       switch(curr->ie_Class)
  35.       {
  36.          case IECLASS_POINTERPOS:
  37.          case IECLASS_RAWMOUSE:
  38.             PosX = IntuitionBase->MouseX;
  39.             PosY = IntuitionBase->MouseY;
  40.             Signal(MyTask,INPUTEVENT);
  41.             break;
  42.          default:
  43.             break;
  44.       }
  45. /*
  46.       if (curr->ie_Class==IECLASS_POINTERPOS)
  47.       {
  48.          PosX = curr->ie_X;
  49.          PosY = curr->ie_Y;
  50.          Signal(MyTask,INPUTEVENT);
  51.  
  52.       }
  53.       else if (curr->ie_Class==IECLASS_RAWMOUSE)
  54.       {
  55.          if (curr->ie_Code==IECODE_NOBUTTON)
  56.          {
  57.             PosX += curr->ie_X;
  58.             PosY += curr->ie_Y;
  59.             Signal(MyTask,INPUTEVENT);
  60.          }
  61.       }
  62.  
  63. */
  64.       curr=curr->ie_NextEvent;
  65.    }
  66.    return(ev);
  67. }
  68.  
  69.